package com.ruoyi.data.es.domain;

import com.fasterxml.jackson.annotation.JsonFormat;
import org.joda.time.DateTime;
import org.springframework.data.annotation.Id;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.format.annotation.DateTimeFormat;

import java.math.BigDecimal;
import java.util.Date;

/**
 * @ClassName SensorData
 * @Author Iven
 * @Description 传感器数据，用于ES存取
 * @Date 2020/12/3 1:15
 */
@Document(indexName = "iot", type = "sensor")
public class SensorData {

    @Id
    private Long id;
    /**
     * 传感器编号
     */
    @Field
    private String code;

    /**
     * 设备编号
     */
    private String equipmentCode;

    /**
     * 数值
     */
    private Double value;

    /**
     * 采集时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date addTime;

    public String getCode() {
        return code;
    }

    public void setCode(String sensorCode) {
        this.code = sensorCode;
    }

    public String getEquipmentCode() {
        return equipmentCode;
    }

    public void setEquipmentCode(String equipmentCode) {
        this.equipmentCode = equipmentCode;
    }

    public Double getValue() {
        return value;
    }

    public void setValue(Double value) {
        this.value = value;
    }

    public Date getAddTime() {
        return addTime;
    }

    public void setAddTime(Date addTime) {
        this.addTime = addTime;
    }

    public SensorData() {
    }

    public SensorData(String code, String equipmentCode, Double value, Date addTime) {
        this.code = code;
        this.equipmentCode = equipmentCode;
        this.value = value;
        this.addTime = addTime;
    }

    @Override
    public String toString() {
        return "SensorData{" +
                "code='" + code + '\'' +
                ", equipmentCode='" + equipmentCode + '\'' +
                ", value=" + value +
                ", addTime=" + addTime +
                '}';
    }
}
